﻿namespace Entity;

/// <summary>
/// 订单
/// </summary>
public class Order : BaseEntity
{
    /// <summary>
    /// 下单人
    /// </summary>
    public int UserId { get; set; }

    /// <summary>
    /// 对应商户
    /// </summary>
    public int StoreId { get; set; }

    /// <summary>
    /// 对应代理
    /// </summary>
    public int ProxyId { get; set; }

    /// <summary>
    /// 订单的实际支付金额
    /// </summary>
    public decimal PayPrice { get; set; }

    /// <summary>
    /// 订单原始金额
    /// </summary>
    public decimal OldPrice { get; set; }

    /// <summary>
    /// 订单号
    /// </summary>
    public string? OrderNo { get; set; }

    /// <summary>
    /// 三方订单号
    /// </summary>
    public string? ThreeOrderNo { get; set; } = "";

    /// <summary>
    /// 支付方式
    /// </summary>
    public PayType PayType { get; set; }

    /// <summary>
    /// 支付状态
    /// </summary>
    public PayStatus PayStatus { get; set; } = PayStatus.未支付;

    /// <summary>
    /// 代理信息
    /// </summary>
    [Navigate(NavigateType.OneToOne, nameof(ProxyId))]
    public Entity.Proxy? Proxy { get; set; }

    /// <summary>
    /// 客户信息
    /// </summary>
    [Navigate(NavigateType.OneToOne, nameof(UserId))]
    public Entity.Client? Client { get; set; }

    /// <summary>
    /// 商户信息
    /// </summary>
    [Navigate(NavigateType.OneToOne, nameof(StoreId))]
    public Entity.Store? Store { get; set; }

    /// <summary>
    /// 支付用户OPENid
    /// </summary>
    public string OpenId { get; set; } = "";

    /// <summary>
    /// 订单类型
    /// </summary>
    public OrderType OrderType { get; set; } = OrderType.拼团返利;

    /// <summary>
    /// 扩展ID 可以用于 拼团编号或对应的商品编号
    /// </summary>
    public int ExtId { get; set; }
}





